{% extends "personnel/base.html" %}

{% block page_link %}
    <link rel="stylesheet" href="../../static/system_setup/css/style.css">
    <link href="../../static/personnel/css/jquery.searchableSelect.css" rel="stylesheet" type="text/css">
{% endblock %}


{% block style %}
    <style>
        .add_class {
            background: #1E90FF;
        }

        .add_background {
            background: #A9A9A9;
        }

        .file {
            position: relative;
            display: inline-block;
            background: #D0EEFF;
            border: 1px solid #99D3F5;
            border-radius: 4px;
            padding: 4px 12px;
            overflow: hidden;
            color: #1E88C7;
            text-decoration: none;
            text-indent: 0;
            line-height: 20px;
        }

        .file input {
            position: absolute;
            font-size: 100px;
            right: 0;
            top: 0;
            opacity: 0;
        }

        .file:hover {
            background: #AADFFD;
            border-color: #78C3F3;
            color: #004974;
            text-decoration: none;
        }

        tr:hover {
            background-color: #DCDCDC;
        }

        .top_tag {
            border-bottom: #01AAED solid 3px;
            color: #01AAED;
        }

        .tab_top {
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: inline-block;
            cursor: pointer;
        }

        #menu {
            /* 隐藏自定义菜单 */
            display: none;
            width: 130px;
            /*自定义菜单相对与body元素进行定位*/
            position: absolute;
            background: white;
            box-shadow: 5px 5px 5px #888888;
        }

        .menu-item {
            height: 30px;
            line-height: 30px;
            {#padding: 0 10px;#}
            cursor: pointer;
            padding-left: 10px;
        }

        .menu-item:hover {
            background-color: #f1f1f1;
        }
        .attendance_tag {
            width: 150px;height: 40px;line-height: 40px;text-align: center;display: inline-block;vertical-align: top;cursor: pointer;
        }
        .attendance_active {
            border-bottom: #1E90FF 1px solid;color: #1E90FF;
        }
        .oline {
            border-top: 40px #fff solid;
            /*上边框宽度等于表格第一行行高*/
            width: 100%;
            /*让容器宽度为0*/
            height: 40px;
            /*让容器高度为0*/
            border-left: 80px #fff solid;
            /*左边框宽度等于表格第一行第一格宽度*/
            position: relative;
            /*让里面的两个子容器绝对定位*/

        }
        .oline::before {
            position: absolute;
            top: -40px;
            left: -80px;
            width: 150%;
            height: 40px;
            background: url() no-repeat 100% center;
            content: '';
        }

        .span1 {
            font-style: normal;
            display: block;
            position: absolute;
            top: -40px;
            left: 80px;
            width: 50%;
        }

        .span2 {
            font-style: normal;
            display: block;
            position: absolute;
            top: -25px;
            left: -70px;
            width: 50%;
        }
    </style>
{% endblock %}


{% block right_content %}
    <div style="width: 100%;height: 100%;background: white;">
        <div style="width: 100%;height: 40px;box-shadow: 0 1px 0 0 #cccccc;">
            <div id="DepartmentalAttendance" class="attendance_tag attendance_active" onclick="change_types(this.id)">
                部门考勤
            </div>
            <div id="LaborAttendance" class="attendance_tag" onclick="change_types(this.id)">
                劳务派遣考勤
            </div>

             <div style="float: right;font-size: 14px;color: #ff2222;height: 40px;line-height: 40px;padding-right: 2%;"><strong>已上传 <a id="uploaded" href="javascript:;">{{ all_count }}</a> 个科室；已确认：<a id="confirmed" href="javascript:;">{{ updata_count }}</a> 个</strong></div>
        </div>

        <div class="headline">
            <div id="dep_head" style="width: 100%;height: 100%;">
                <div style="height: 40px;display: inline-block;">
                    <div id="attendance_summary_tab" onclick="change_mind('attendance_summary')" class="tab_top top_tag">
                        考勤汇总
                    </div>
                    <div id="department_statistics_tab" onclick="change_mind('department_statistics')" class="tab_top">
                        部门统计
                    </div>
                </div>

                {% if is_audit == 'true' %}
                    <button id="sign_but" onclick="sgin_people()" style="width: 70px;height: 30px;line-height: 25px;border-radius: 3px;margin-top: 5px;background: #00a0e9;border: #00a0e9 solid 0.5px;color: white;letter-spacing: 3px;margin-right: 15px;display: inline-block;">
                        签字
                    </button>
                {% endif %}

                <div id="search_but" onclick="select_dep_name()" style="float: right;vertical-align: top;width: 80px;margin-left: 10px;margin-top: 2px;margin-right: 10px;">
                    <button style="width: 70px;margin-top: 2px;height:32px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;background: #00a0e9;color: white;border-radius: 3px;">
                        搜索
                    </button>
                </div>

                <div id="select_year" style="float: right;vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;">
                    <select name="year" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="year" class="dept_select">
                        {% for year_dict in year_list %}
                            <option value="{{ year_dict.value }}">{{ year_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>

                <div id="select_month" style="float: right;vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;">
                    <select name="month" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="month" class="dept_select">
                        {% for mon_dict in month_list %}
                            <option value="{{ mon_dict.value }}">{{ mon_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>

                <div id="select_dep" style="float: right;vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;display: none;margin-right: 10px;">
                    <select name="dept" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="dept" class="dept_select">
                        <option value="">请选择科室</option>
                        {% for dep_dict in dep_dict_list %}
                            <option value="{{ dep_dict.value }}">{{ dep_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>

            <div id="Labor_head" style="width: 100%;height: 100%;display: none;">
                <div style="height: 40px;display: inline-block;">
                    <div id="Labor_summary_tab" onclick="change_mind1('LaborSummary')" class="tab_top top_tag">
                        考勤汇总
                    </div>
                    <div id="Labor_statistics_tab" onclick="change_mind1('LaborStatistics')" class="tab_top">
                        部门统计
                    </div>
                </div>

                {% if is_dispatch_audit == 'true' %}
                    <button id="dispatch_sign_but" onclick="sgin_people()" style="width: 70px;height: 30px;line-height: 25px;border-radius: 3px;margin-top: 5px;background: #00a0e9;border: #00a0e9 solid 0.5px;color: white;letter-spacing: 3px;display: inline-block;margin-right: 15px;margin-left: 15px;">
                        签字
                    </button>
                {% endif %}

                <div id="search_dep_but" onclick="search_dispatch('1')" style="float: right;vertical-align: top;width: 80px;margin-left: 10px;margin-top: 2px;margin-right: 10px;">
                    <button style="width: 70px;margin-top: 2px;height:32px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;background: #00a0e9;color: white;border-radius: 3px;">
                        搜索
                    </button>
                </div>

                <div id="select_dep_year" style="float: right;vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;">
                    <select name="year1" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="year1" class="dept_select">
                        {% for year_dict in dispatch_year_list %}
                            <option value="{{ year_dict.value }}">{{ year_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>

                <div id="select_dep_month" style="float: right;vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;margin-right: 10px;">
                    <select name="month1" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="month1" class="dept_select">
                        <option value="">请选择月份</option>
                        {% for mon_dict in dispatch_month_list %}
                            <option value="{{ mon_dict.value }}">{{ mon_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>

                <div id="select_dep_dep" style="float: right;vertical-align: top;width: 250px;margin-left: 10px;margin-top: 2.5px;display: none;margin-right: 10px;">
                    <select name="dept1" style="width: 250%;margin-top: 5px;height:30px;z-index: 100;font-size: 14px;border: #00a0e9 solid 1px;" id="dept1" class="dept_select">
                        <option value="">请选择科室</option>
                        {% for dep_dict in dispatch_dep_dict_list %}
                            <option value="{{ dep_dict.value }}">{{ dep_dict.name }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
        </div>

        <div id="DepartmentQuery" style="width: 100%;height: 90%;overflow: auto;">
            <div id="AttendanceStatistics" style="width: 100%;height: 100%;overflow: auto;">
                <table id="SummaryQuery" style="width: 100%;margin-bottom: 10%;">
                    <tr style="width: 100%;">
                        <th colspan="23" style="height: 40px;width: 100%;border: #CCCCCC solid 0.5px;text-align: center;line-height: 40px;font-size: 18px;letter-spacing: 3px;border-top: none;">{{ gauge_outfit }}</th>
                    </tr>
                    <tr>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">
                            序号
                        </td>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">
                            科室
                        </td>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                            工号
                        </td>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">
                            执业
                        </td>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                            姓名
                        </td>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 20px;text-align: center;">
                            实际<br>出勤<br>天数
                        </td>
                        <td colspan="16"
                            style="border: #CCCCCC solid 0.5px;width: 56%;height: 35px;line-height: 35px;text-align: center;letter-spacing: 2cm;">
                            考勤动态
                        </td>
                        <td rowspan="2"
                            style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">
                            备注
                        </td>
                    </tr>
                    <tr>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            上班
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            援荆
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            隔离
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            外差
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            进修
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            计生假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            产假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            年休假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            事假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            病假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            工伤
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            探亲
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            婚假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            丧假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            放射假
                        </td>
                        <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">
                            育儿假
                        </td>
                    </tr>
                    {% for Foo in AttendanceObj %}
                        <tr style="width: 100%;">
                            <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.serial }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 10%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.department }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.job_number }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.practice }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.name }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3%;height: 35px;line-height: 20px;text-align: center;">{{ Foo.attendance_days }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.work_days }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.aid_jing }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.quarantine }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.heterodyne }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.education }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.planning }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.maternity }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.annual }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.absence }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.sick }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.industrial }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.visit }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.marriage }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.bereavement }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.vacation }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 3.5%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.parental_leave }}</td>
                            <td style="border: #CCCCCC solid 0.5px;width: 15%;height: 35px;line-height: 35px;text-align: center;">{{ Foo.notes }}</td>
                        </tr>
                    {% endfor %}
                    <tr>
                        <td colSpan="23" style="border: #CCCCCC solid 0.5px;width: 100%;height: 50px;line-height: 50px;">
                            <p style="float: left;margin-left: 10%;">
                                <span>审核人签字：</span>
                                {% if audit_dic %}
                                    <span id="HeadSignature"><img src="{{ audit_dic.signature_picture }}" style="width: 100px;height: 35px;"></span>
                                {% endif %}
                            </p>
                        </td>
                    </tr>
                </table>
            </div>

            <div id="DepartmentStatistics" style="width: 100%;height: 100%;overflow: auto;display: none;">
                <div id="DepartmentQuery" style="width: 100%;height: 100%;">
                    <div id="DepartmentQueryFirst"
                         style="width: 100%;height: 95%;display: flex;align-items:center;justify-content:center;">
                        <div style="width: 150px;height: 70px;left:50%;top:50%;text-align: center;">
                            <img src="../../static/public_file/images/暂无数据.png" alt="" style="width: 50px;height: 50px;">
                            <p style="color: #cfcfcf;">请选择查看科室</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div id="LaborDispatch" style="width: 100%;height: 90%;overflow: auto;display: none;vertical-align: top;">
            <div id="LaborSummary" style="width: 100%;height: 100%;overflow: auto;">
                {% if DispatchTitle %}
                    <div style="width: 100%;height: 100%;">
                        <div id="create_depar_table" style="width: 100%;">
                            <table style="width: 100%;margin-bottom: 10%;">
                                <tr style="width: 100%;">
                                    <th colspan="11" style="height: 40px;width: 100%;border: #CCCCCC solid 0.5px;text-align: center;line-height: 40px;font-size: 18px;letter-spacing: 3px;border-top: none;">{{ DispatchTitle }}</th>
                                </tr>
                                <tr style="width: 100%;">
                                    <td colspan="11" style="height: 35px;width: 100%;border: #CCCCCC solid 0.5px;line-height: 35px;">
                                        <p style="display: inline-block;vertical-align: top;padding-left: 20px;">
                                            审核人签字：
                                            {% if dispatch_dic %}
                                                <span id="RskSignature"><img src="{{ dispatch_dic.signature_picture }}" style="width: 100px;height: 35px;"></span>
                                            {% endif %}
                                        </p>
{#                                        <p style="float: right;margin-right: 60px;">上报时间：{{ DispatchCreate }}</p>#}
                                    </td>
                                </tr>
                                <tr>
                                    <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                        序号
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        科室
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 14%;height: 35px;line-height: 35px;text-align: center;">
                                        <div class="oline"> <span class="span1">考核项目</span> <span class="span2">姓 名</span> </div>
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        实际出勤天数
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        请假类别及天数
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        劳动纪律（20分）
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        工作质量（30分）
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        工作能力（30分）
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        其他（20分）
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        总得分
                                    </td>
                                    <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                        备注
                                    </td>
                                </tr>
                                {% for Dispatch in DispatchObj %}
                                    <tr>
                                        <td style="border: #CCCCCC solid 0.5px;width: 5%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.serial }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.department }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 14%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.project_name }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.attendance_days }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.leave_type }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.labor_discipline }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.work_quality }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.working_ability }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.other }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.total_score }}
                                        </td>
                                        <td style="border: #CCCCCC solid 0.5px;width: 9%;height: 35px;line-height: 35px;text-align: center;">
                                            {{ Dispatch.notes }}
                                        </td>
                                    </tr>
                                {% endfor %}
                            </table>
                        </div>
                    </div>
                {% else %}
                    <div style="width: 100%;height: 95%;display: flex;align-items:center;justify-content:center;">
                        <div style="width: 150px;height: 70px;left:50%;top:50%;text-align: center;">
                            <img src="../../static/public_file/images/暂无数据.png" alt="" style="width: 50px;height: 50px;">
                            <p style="color: #cfcfcf;">暂无数据</p>
                        </div>
                    </div>
                {% endif %}
            </div>

            <div id="LaborStatistics" style="width: 100%;height: 100%;overflow: auto;display: none;">
                <div id="DepartmentQuery" style="width: 100%;height: 100%;">
                    <div id="DispatchTable" style="width: 100%;height: 95%;">
                        <div style="width: 100%;height: 100%;display: flex;align-items:center;justify-content:center;">
                            <div style="width: 150px;height: 70px;left:50%;top:50%;text-align: center;">
                                <img src="../../static/public_file/images/暂无数据.png" alt="" style="width: 50px;height: 50px;">
                                <p style="color: #cfcfcf;">请选择查看科室</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div id="menu">
        <div class="menu-item" id="ExportData" onclick="ExportData('summary')" data-id="1">
            导出数据
        </div>
    </div>
{% endblock %}

{% block script %}
    <script src="../../static/personnel/js/jquery-1.11.1.min.js"></script>
    <script src="../../static/personnel/dep_js/jquery.searchableSelect.js"></script>
    <script type="text/javascript">
        window.onload = function () {
            document.getElementById("astic").className = "add_class";
            document.getElementById("attendance").className = "add-nav-active";

            //获取我们自定义的右键菜单
            const menu = document.querySelector('#menu')

            // 右键打开菜单
            window.oncontextmenu = function (e) {
                //取消默认的浏览器自带右键 很重要！！
                e.preventDefault()

                //根据事件对象中鼠标点击的位置，进行定位
                menu.style.left = e.clientX + 'px'
                menu.style.top = e.clientY + 'px'

                //改变自定义菜单的宽，让它显示出来
                menu.style.display = 'block'
            }

            //关闭右键菜单，很简单
            window.onclick = function (e) {
                //用户触发click事件就可以关闭了，因为绑定在window上，按事件冒泡处理，不会影响菜单的功能
                menu.style.display = 'none'
            }

            // 监听菜单点击
            menu.addEventListener('click', function (e) {
                console.log(e.target.dataset.id)
            })

        };

        function upload_excel(types) {
            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();

            var files = document.getElementById("party_main_body").files[0];
            form.append('types', types);
            form.append('file', files);
            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/UploadExcel", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        alert(JsonDate['message'])
                        if (JsonDate['code'] === 200) {
                            location.reload()
                        }
                        document.getElementById("party_main_body").value = "";
                    }
                }
            };
        }

        function sgin_people() {
            var r = confirm("请确认是否所有科室都已上传考勤！")
            if (r === true) {
                var form = new FormData();
                var types = document.getElementsByClassName("attendance_tag attendance_active");
                if (types[0].id === 'DepartmentalAttendance') {
                    form.append('types', '1');
                }else {
                    form.append('types', '2');
                }
                document.getElementById("loading").style.display = "inline-block";

                var xhr = new XMLHttpRequest();
                var local_host = window.location.host;          // 获取当前IP
                xhr.open('post', "/system-setup/SignaturePersonnel", true);
                xhr.send(form);
                xhr.onreadystatechange = function () {
                    if (xhr.readyState === 4) {
                        if (xhr.status === 200) {
                            document.getElementById("loading").style.display = "none";
                            var JsonDate = JSON.parse(xhr.responseText);
                            console.log(JsonDate);
                            alert("签名成功！")
                            if (JsonDate['code'] === 200) {
                                location.reload()
                            }
                        }
                    }
                };
            }
        }

        function change_mind(ele_id) {
            var is_audit = "{{ is_audit | safe }}";
            if (ele_id === "attendance_summary") {
                document.getElementById("attendance_summary_tab").className = "tab_top top_tag";
                document.getElementById("department_statistics_tab").className = "tab_top";
                {#document.getElementById("my_application_tab").className = "tab_top";#}
                if (is_audit === "true") {
                    document.getElementById("sign_but").style.display = "inline-block";
                }
                document.getElementById("select_dep").style.display = "none";
                document.getElementById("select_month").style.display = "inline-block";
                document.getElementById("select_year").style.display = "inline-block";
                document.getElementById("search_but").style.display = "inline-block";
                {#document.getElementById("SignatureStatistics").style.display = "none";#}
                document.getElementById("DepartmentStatistics").style.display = "none";
                document.getElementById("AttendanceStatistics").style.display = "inline-block";
                document.getElementById("ExportData").setAttribute("onclick", "ExportData('summary')")
            } else {
                {#document.getElementById("my_application_tab").className = "tab_top";#}
                document.getElementById("attendance_summary_tab").className = "tab_top";
                document.getElementById("department_statistics_tab").className = "tab_top top_tag";
                if (is_audit === "true") {
                    document.getElementById("sign_but").style.display = "none";
                }
                document.getElementById("select_dep").style.display = "inline-block";
                document.getElementById("select_month").style.display = "inline-block";
                document.getElementById("select_year").style.display = "inline-block";
                document.getElementById("search_but").style.display = "inline-block";
                {#document.getElementById("SignatureStatistics").style.display = "none";#}
                document.getElementById("DepartmentStatistics").style.display = "inline-block";
                document.getElementById("AttendanceStatistics").style.display = "none";
                document.getElementById("ExportData").setAttribute("onclick", "ExportData('department')")
            }
        }

        $(function () {
            $('select').searchableSelect();
        });

        function ExportData(ele_type) {
            if (ele_type === "summary") {
                var year_val = document.getElementById("year").value;
                var month_val = document.getElementById("month").value;
             } else {
                year_val = document.getElementById("year").value;
                month_val = document.getElementById("month").value;
                var dept_val = document.getElementById("dept").value;
             }

            document.getElementById("loading").style.display = "inline-block";
            var form = new FormData();

            var dowload_type = document.getElementsByClassName('attendance_tag attendance_active')[0].id;
            if (dowload_type === 'LaborAttendance') {
                var DownLoadType = '2';
                form.append('year', document.getElementById("year1").value);
                form.append('month', month_val = document.getElementById("month1").value);
             }else {
                DownLoadType = '1'
             }

            form.append('types', ele_type);
            form.append('DownLoadType', DownLoadType);
            if (year_val) {
                form.append('year', year_val);
             }

            if (month_val) {
                form.append('month', month_val);
             }

            if (dept_val) {
                form.append('dept', dept_val);
             }

            var xhr = new XMLHttpRequest();
            var local_host = window.location.host;          // 获取当前IP
            xhr.open('post', "/system-setup/ExportData", true);
            xhr.send(form);
            xhr.onreadystatechange = function () {
                if (xhr.readyState === 4) {
                    if (xhr.status === 200) {
                        document.getElementById("loading").style.display = "none";
                        var JsonDate = JSON.parse(xhr.responseText);
                        console.log(JsonDate);
                        if (JsonDate['code'] === 200) {
                            window.location.href="/system-setup/download_file?file_path="+JsonDate["data"]["file_path"]
                         }
                        document.getElementById("party_main_body").value = "";
                    }
                }
             };
        }

        function change_types(ele_id) {
            var all_count = "{{ all_count | safe }}";             // 所有上传科室（科室考勤）
            var updata_count = "{{ updata_count | safe }}";       // 已确认（科室考勤）
            var dispatch_all_count = "{{ dispatch_all_count | safe }}";             // 所有上传科室（劳务派遣）
            var dispatch_updata_count = "{{ dispatch_updata_count | safe }}";       // 已确认（劳务派遣）
            if (ele_id === "DepartmentalAttendance") {
                document.getElementById(ele_id).className="attendance_tag attendance_active";
                document.getElementById("LaborAttendance").className="attendance_tag";
                document.getElementById("DepartmentQuery").style.display="inline-block";
                document.getElementById("LaborDispatch").style.display="none";
                document.getElementById("dep_head").style.display="inline-block";
                document.getElementById("Labor_head").style.display="none";
                document.getElementById("uploaded").innerText = all_count;
                document.getElementById("confirmed").innerText = updata_count;
            }else {
                document.getElementById(ele_id).className="attendance_tag attendance_active";
                document.getElementById("DepartmentalAttendance").className="attendance_tag";
                document.getElementById("LaborDispatch").style.display="inline-block";
                document.getElementById("DepartmentQuery").style.display="none";
                document.getElementById("dep_head").style.display="none";
                document.getElementById("Labor_head").style.display="inline-block";
                document.getElementById("uploaded").innerText = dispatch_all_count;
                document.getElementById("confirmed").innerText = dispatch_updata_count;
            }
        }

        function change_mind1(ele_id) {
            var is_dispatch_audit = "{{ is_dispatch_audit | safe }}";
            if (ele_id === "LaborSummary") {
                document.getElementById("Labor_summary_tab").className="tab_top top_tag";
                document.getElementById("Labor_statistics_tab").className="tab_top";
                document.getElementById("LaborSummary").style.display="inline-block";
                document.getElementById("LaborStatistics").style.display="none";
                document.getElementById("select_dep_dep").style.display="none";
                if (is_dispatch_audit === "true") {
                    document.getElementById("dispatch_sign_but").style.display = "inline-block";
                }else {
                    document.getElementById("dispatch_sign_but").style.display = "none";
                }
                document.getElementById("search_dep_but").setAttribute("onclick", "search_dispatch('1')")
            }else {
                document.getElementById("Labor_statistics_tab").className="tab_top top_tag";
                document.getElementById("Labor_summary_tab").className="tab_top";
                document.getElementById("LaborStatistics").style.display="inline-block";
                document.getElementById("LaborSummary").style.display="none";
                document.getElementById("dispatch_sign_but").style.display = "none";
                document.getElementById("select_dep_dep").style.display="inline-block";
                document.getElementById("search_dep_but").setAttribute("onclick", "search_dispatch('2')")
            }
        }
    </script>
{% endblock %}



